package networkinstance;

public class Main8 {
    public static void main(String[] args) {
        try {
            java.net.URL url = new java.net.URL("http://www.runoob.com/html/html-tutorial.html");
            System.out.println("URL 是 " + url);
            System.out.println("协议是 " + url.getProtocol());
            System.out.println("文件名是 " + url.getFile());
            System.out.println("主机是 " + url.getHost());
            System.out.println("路径是 " + url.getPath());
            System.out.println("端口号是 " + url.getPort());
            System.out.println("默认端口号是 " + url.getDefaultPort());
        } catch (java.net.MalformedURLException e) {
            throw new RuntimeException(e);
        }
    }
}
